window.onload = function(){
    // 展开与收起
    var gs = 0;
    $('.gs').click(function (e) {
        e.stopPropagation()
        if($(this).get(0).checked){
            $(this).parents('.weui_cell_list').next('.inputBox').slideDown("slow");
            gs = 1
        } else {
            $(this).parents('.weui_cell_list').next('.inputBox').slideUp("slow")
            gs = 0
        }
    })
    var sx = 0;
    $('.sx').click(function (e) {
        e.stopPropagation()
        if($(this).get(0).checked){
            $(this).parents('.weui_cell_list').next('.inputBox').slideDown("slow");
            sx = 1
        } else {
            $(this).parents('.weui_cell_list').next('.inputBox').slideUp("slow")
            sx = 0
        }
    })
    var buy = 0;
    $('.buy').click(function (e) {
        e.stopPropagation()
        if($(this).get(0).checked){
            $(this).parents('.weui_cell_list').next('.inputBox').slideDown("slow");
            buy = 1
        } else {
            $(this).parents('.weui_cell_list').next('.inputBox').slideUp("slow")
            buy = 0
        }
    })
    var shihe = 0;
    $('.shihe').click(function (e) {
        e.stopPropagation()
        if($(this).get(0).checked){
            $(this).parents('.weui_cell_list').next('.inputBox').slideDown("slow");
            shihe = 1
        } else {
            $(this).parents('.weui_cell_list').next('.inputBox').slideUp("slow")
            shihe = 0
        }
    })
    // 获取应聘职位以及应聘类型
    var positionList;
    var typeTrench = [];
    var position1 = [];
    var position2 = [];
    var typeTrench2 = [];
    var typeTval = [];
    positionList = ajax("http://hplqytest.suoluomei.cn/index.php?s=/Hr/Index/getPosition_Channel_typeJob", '', function (res) {
        let data = res;
        position1 = data.data.position
        typeTrench = data.data.channel_type
        for (let index in position1) {
            position2[index] = position1[index].name
        }
        for (let index in typeTrench) {
            typeTrench2[index] = typeTrench[index].name
            typeTval[index] = typeTrench[index]
        }
    })
    // 应聘职位
    $("#position").picker({
        title: "-- 请选择 --",
        cols: [
            {
                textAlign: 'center',
                values: position2
            }
        ]
    });
    // 应聘类型
    var trenchList;
    var tempArr = [];
    var arrList = [];
    $("#trench1").picker({
        title: "-- 请选择 --",
        cols: [
            {
                textAlign: 'center',
                values: typeTrench2
            }
        ],
        onClose: function (picker) {
            tempArr.length=0
            let comparison = []
            let comparisonvalue = []
            $('#trench1').val(picker.cols[0].value)
            let value = $('#trench1').val()
            for (let index in typeTval) {
                comparison[index] = typeTval[index].name
                comparisonvalue[index] = typeTval[index].value
                if (comparison[index] == value) {
                    // 拿到应聘类型value获取应聘渠道
                    trenchList = ajax("http://hplqytest.suoluomei.cn/index.php?s=/Hr/Index/getChannelJob", comparisonvalue[index], function (res) {
                        $("#trench2").val('')
                        let data = res.data.channel;
                        arrList = data;
                        for (let index in data) {
                            tempArr[index] = data[index].name
                        }
                    })
                }
            }
        }
    });
    // 应聘渠道
    $("#trench2").picker({
        title: "-- 请选择 --",
        cols: [
            {
                textAlign: 'center',
                values: tempArr
            }
        ],
        onOpen:function (picker) {
            picker.setValue(tempArr);
            picker.updateValue()
        },
        onClose:function (picker) {
            picker.updateValue()
        }
    });
    // 获取后台数据
    var channel_id;
    var name_channel;
    var key = '195a9b99ea7a0d259151b5c412bb631b';
    $.ajax({
        type: "POST",
        url: 'http://hplqytest.suoluomei.cn/index.php?s=/Hr/Index/getPerfectSave',
        data: {api_key: key},
        dataType: "json",
        success: function (res) {
            let data = res;
            console.log(data)
            channel_id = data.data.perfectSave.channel_id
            name_channel = data.data.perfectSave.name_channel
            $('.trench1').val(data.data.perfectSave.name_type)
            $('.trench2').val(data.data.perfectSave.name_channel)
            $('.myName').val(data.data.perfectSave.name)
            if (data.data.perfectSave.sex == '女') {
                $($("input[name='radio1']")[0]).attr('checked', 'checked')
            }else {
                $($("input[name='radio1']")[1]).attr('checked', 'checked')
            }
            $('.phone').val(data.data.perfectSave.mobile)
            $('.inviteName').val(data.data.perfectSave.invitations)
            $('.birthday').val(data.data.perfectSave.birth)
            $('.email').val(data.data.perfectSave.email)
            $('.WeChat').val(data.data.perfectSave.wechat)
            $('.position').val(data.data.perfectSave.name_job)
            $('.native').val(data.data.perfectSave.native_place)
            $('.nation').val(data.data.perfectSave.nation)
            $('.marriage').val(data.data.perfectSave.marriage)
            $('.politics').val(data.data.perfectSave.politics)
            $('.identity').val(data.data.perfectSave.idcard)
            $('.registe').val(data.data.perfectSave.household)
            $('.weight').val(data.data.perfectSave.weight)
            $('.stature').val(data.data.perfectSave.height)
            $('.site').val(data.data.perfectSave.address)
            $('.certificate').val(data.data.perfectSave.certificate)
            $('.hobby').val(data.data.perfectSave.hobby)
            $('.speciality').val(data.data.perfectSave.speciality)

            $('.gsName').val(data.data.perfectSave.company_relatives_name)
            $('.gsGuan').val(data.data.perfectSave.company_relatives_relation)
            $('.sxName').val(data.data.perfectSave.compete_relatives_name)
            $('.sxGuan').val(data.data.perfectSave.compete_relatives_relation)
            $('.buyName').val(data.data.perfectSave.hf_teacher_name)
            $('.noShihe').val(data.data.perfectSave.not_arrange_work)

            if(data.data.content.length>0) {
                for (let i = 0; i < data.data.content.length; i++) {
                    let myli = "<div class=\"urgencyBottom\">\n" +
                        "                <div class=\"experImgDetele relDelete\">\n" +
                        "                  <img src=\"./img/detele.svg\" alt=\"\">\n" +
                        "                </div>\n" +
                        "                <div class=\"heig\" style=\"height: 39px;background: #f3f3f3\"></div>\n" +
                        "                <div class=\"experListTop urgencyList\">\n" +
                        "                  <div class=\"weui_cell\">\n" +
                        "                    <div class=\"weui_cell_hd\">\n" +
                        "                      <label class=\"weui_label\">关系</label>\n" +
                        "                    </div>\n" +
                        "                    <div class=\"weui_cell_bd weui_cell_primary select\">\n" +
                        "                      <input class=\"weui_input choice kinsfolk\" name=\"urgency\" id="+ 'guanxi' + i +" type=\"text\" placeholder=\"-- 请选择 --\" value="+ data.data.content[i].relation_name +">\n" +
                        "                    </div>\n" +
                        "                  </div>\n" +
                        "                  <div class=\"weui_cell\">\n" +
                        "                    <div class=\"weui_cell_hd\">\n" +
                        "                      <label class=\"weui_label\">紧急联系人</label>\n" +
                        "                    </div>\n" +
                        "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                        "                      <input class=\"weui_input\" type=\"text\" name=\"urgency\" placeholder=\"请填写联系人姓名\" value="+ data.data.content[i].name +">\n" +
                        "                    </div>\n" +
                        "                  </div>\n" +
                        "                  <div class=\"weui_cell\">\n" +
                        "                    <div class=\"weui_cell_hd\">\n" +
                        "                      <label class=\"weui_label\">手机</label>\n" +
                        "                    </div>\n" +
                        "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                        "                      <input class=\"weui_input\" type=\"number\" name=\"urgency\" placeholder=\"请填写联系人手机\" value="+ data.data.content[i].mobile +">\n" +
                        "                    </div>\n" +
                        "                  </div>\n" +
                        "                </div>\n" +
                        "              </div>";
                    $('#urgencyList').append(myli);
                }
            } else{
                let myli = "<div class=\"urgencyBottom\">\n" +
                    "                <div class=\"experImgDetele relDelete\">\n" +
                    "                  <img src=\"./img/detele.svg\" alt=\"\">\n" +
                    "                </div>\n" +
                    "                <div class=\"heig\" style=\"height: 39px;background: #f3f3f3\"></div>\n" +
                    "                <div class=\"experListTop urgencyList\">\n" +
                    "                  <div class=\"weui_cell\">\n" +
                    "                    <div class=\"weui_cell_hd\">\n" +
                    "                      <label class=\"weui_label\">关系</label>\n" +
                    "                    </div>\n" +
                    "                    <div class=\"weui_cell_bd weui_cell_primary select\">\n" +
                    "                      <input class=\"weui_input choice kinsfolk\" name=\"urgency\" id=\"guanxi\" type=\"text\" placeholder=\"-- 请选择 --\">\n" +
                    "                    </div>\n" +
                    "                  </div>\n" +
                    "                  <div class=\"weui_cell\">\n" +
                    "                    <div class=\"weui_cell_hd\">\n" +
                    "                      <label class=\"weui_label\">紧急联系人</label>\n" +
                    "                    </div>\n" +
                    "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                    "                      <input class=\"weui_input\" type=\"text\" name=\"urgency\" placeholder=\"请填写联系人姓名\">\n" +
                    "                    </div>\n" +
                    "                  </div>\n" +
                    "                  <div class=\"weui_cell\">\n" +
                    "                    <div class=\"weui_cell_hd\">\n" +
                    "                      <label class=\"weui_label\">手机</label>\n" +
                    "                    </div>\n" +
                    "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                    "                      <input class=\"weui_input\" type=\"number\" name=\"urgency\" placeholder=\"请填写联系人手机\">\n" +
                    "                    </div>\n" +
                    "                  </div>\n" +
                    "                </div>\n" +
                    "              </div>";
                $('#urgencyList').append(myli);
            }
            if(data.data.study.length>0) {
                for (let i = 0; i < data.data.study.length; i++) {
                    let myli = " <div class=\"educationBottom\">\n" +
                        "                <div class=\"experImgDetele eduDelete\">\n" +
                        "                  <img src=\"./img/detele.svg\" alt=\"\">\n" +
                        "                </div>\n" +
                        "                <div class=\"heig\" style=\"height: 39px;background: #f3f3f3\"></div>\n" +
                        "                <div class=\"experListTop educationList\">\n" +
                        "                  <div class=\"weui_cell\">\n" +
                        "                    <div class=\"weui_cell_hd\"><label for=\"\" class=\"weui_label\">开始时间</label></div>\n" +
                        "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                        "                      <input class=\"weui_input my-input\" name=\"edu\" id="+ 'kaishi' + i +"  type=\"text\" value="+ data.data.study[i].start_date +">\n" +
                        "                    </div>\n" +
                        "                  </div>\n" +
                        "                  <div class=\"weui_cell\">\n" +
                        "                    <div class=\"weui_cell_hd\"><label for=\"\" class=\"weui_label\">结束时间</label></div>\n" +
                        "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                        "                      <input class=\"weui_input my-input\" name=\"edu\" id="+ 'end' + i +"  type=\"text\" value="+ data.data.study[i].end_date +">\n" +
                        "                    </div>\n" +
                        "                  </div>\n" +
                        "                  <div class=\"weui_cell\">\n" +
                        "                    <div class=\"weui_cell_hd\">\n" +
                        "                      <label class=\"weui_label\">毕业院校全称</label>\n" +
                        "                    </div>\n" +
                        "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                        "                      <input class=\"weui_input\" name=\"edu\" type=\"text\" placeholder=\"请填写毕业院校\" value="+ data.data.study[i].school_name +">\n" +
                        "                    </div>\n" +
                        "                  </div>\n" +
                        "                  <div class=\"weui_cell\">\n" +
                        "                    <div class=\"weui_cell_hd\">\n" +
                        "                      <label class=\"weui_label\">专业</label>\n" +
                        "                    </div>\n" +
                        "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                        "                      <input class=\"weui_input\" name=\"edu\" type=\"text\" placeholder=\"请填写专业\" value="+ data.data.study[i].major +">\n" +
                        "                    </div>\n" +
                        "                  </div>\n" +
                        "                  <div class=\"weui_cell\">\n" +
                        "                    <div class=\"weui_cell_hd\">\n" +
                        "                      <label class=\"weui_label\">学历及学位</label>\n" +
                        "                    </div>\n" +
                        "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                        "                      <input class=\"weui_input educat\" id="+ 'education' + i +" name=\"edu\" type=\"text\" placeholder=\"-- 请选择 --\" value="+ data.data.study[i].degree_name +">\n" +
                        "                    </div>\n" +
                        "                  </div>\n" +
                        "                </div>\n" +
                        "              </div>";
                    $('#educationList').append(myli);
                }
            } else{
                let myli = " <div class=\"educationBottom\">\n" +
                    "                <div class=\"experImgDetele eduDelete\">\n" +
                    "                  <img src=\"./img/detele.svg\" alt=\"\">\n" +
                    "                </div>\n" +
                    "                <div class=\"heig\" style=\"height: 39px;background: #f3f3f3\"></div>\n" +
                    "                <div class=\"experListTop educationList\">\n" +
                    "                  <div class=\"weui_cell\">\n" +
                    "                    <div class=\"weui_cell_hd\"><label for=\"\" class=\"weui_label\">开始时间</label></div>\n" +
                    "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                    "                      <input class=\"weui_input my-input\" name=\"edu\" id=\"kaishi\" type=\"text\" value=\"\">\n" +
                    "                    </div>\n" +
                    "                  </div>\n" +
                    "                  <div class=\"weui_cell\">\n" +
                    "                    <div class=\"weui_cell_hd\"><label for=\"\" class=\"weui_label\">结束时间</label></div>\n" +
                    "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                    "                      <input class=\"weui_input my-input\" name=\"edu\" id=\"end\" type=\"text\" value=\"\">\n" +
                    "                    </div>\n" +
                    "                  </div>\n" +
                    "                  <div class=\"weui_cell\">\n" +
                    "                    <div class=\"weui_cell_hd\">\n" +
                    "                      <label class=\"weui_label\">毕业院校全称</label>\n" +
                    "                    </div>\n" +
                    "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                    "                      <input class=\"weui_input\" name=\"edu\" type=\"text\" placeholder=\"请填写毕业院校\">\n" +
                    "                    </div>\n" +
                    "                  </div>\n" +
                    "                  <div class=\"weui_cell\">\n" +
                    "                    <div class=\"weui_cell_hd\">\n" +
                    "                      <label class=\"weui_label\">专业</label>\n" +
                    "                    </div>\n" +
                    "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                    "                      <input class=\"weui_input\" name=\"edu\" type=\"text\" placeholder=\"请填写专业\">\n" +
                    "                    </div>\n" +
                    "                  </div>\n" +
                    "                  <div class=\"weui_cell\">\n" +
                    "                    <div class=\"weui_cell_hd\">\n" +
                    "                      <label class=\"weui_label\">学历及学位</label>\n" +
                    "                    </div>\n" +
                    "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                    "                      <input class=\"weui_input\" name=\"edu\" type=\"text\" placeholder=\"请填写学历及学位\">\n" +
                    "                    </div>\n" +
                    "                  </div>\n" +
                    "                </div>\n" +
                    "              </div>";
                $('#educationList').append(myli);
            }
            if(data.data.work.length>0) {
                for (let i = 0; i < data.data.work.length; i++) {
                    let myli = "<div class=\"experBottom\">\n" +
                        "                <div class=\"experImgDetele workDelete\">\n" +
                        "                  <img src=\"./img/detele.svg\" alt=\"\">\n" +
                        "                </div>\n" +
                        "                <div class=\"heig\" style=\"height: 39px;background: #f3f3f3\"></div>\n" +
                        "                <div class=\"experListTop experienceList\">\n" +
                        "                  <div class=\"weui_cell\">\n" +
                        "                    <div class=\"weui_cell_hd\"><label for=\"\" class=\"weui_label\">开始时间</label></div>\n" +
                        "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                        "                      <input class=\"weui_input my-input\" name=\"work\" id="+ 'my-input3' + i +" type=\"text\" value="+ data.data.work[i].start_date +">\n" +
                        "                    </div>\n" +
                        "                  </div>\n" +
                        "                  <div class=\"weui_cell\">\n" +
                        "                    <div class=\"weui_cell_hd\"><label for=\"\" class=\"weui_label\">结束时间</label></div>\n" +
                        "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                        "                      <input class=\"weui_input my-input\" name=\"work\" id="+ 'my-input4' + i +" type=\"text\" value="+ data.data.work[i].start_date +">\n" +
                        "                    </div>\n" +
                        "                  </div>\n" +
                        "                  <div class=\"weui_cell\">\n" +
                        "                    <div class=\"weui_cell_hd\">\n" +
                        "                      <label class=\"weui_label\">工作单位全称</label>\n" +
                        "                    </div>\n" +
                        "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                        "                      <input class=\"weui_input outfocus\" name=\"work\" type=\"text\" placeholder=\"请填写工作单位\" value="+ data.data.work[i].company_name +">\n" +
                        "                    </div>\n" +
                        "                  </div>\n" +
                        "                  <div class=\"weui_cell\">\n" +
                        "                    <div class=\"weui_cell_hd\">\n" +
                        "                      <label class=\"weui_label\">部门及职位</label>\n" +
                        "                    </div>\n" +
                        "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                        "                      <input class=\"weui_input outfocus\" name=\"work\" type=\"text\" placeholder=\"请填写部门及职位\" value="+ data.data.work[i].job_name +">\n" +
                        "                    </div>\n" +
                        "                  </div>\n" +
                        "                  <div class=\"weui_cell\">\n" +
                        "                    <div class=\"weui_cell_hd\">\n" +
                        "                      <label class=\"weui_label\">离职原因</label>\n" +
                        "                    </div>\n" +
                        "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                        "                      <input class=\"weui_input outfocus\" name=\"work\" type=\"text\" placeholder=\"请填写离职原因\" value="+ data.data.work[i].leave_reason +">\n" +
                        "                    </div>\n" +
                        "                  </div>\n" +
                        "                  <div class=\"weui_cell\">\n" +
                        "                    <div class=\"weui_cell_hd\">\n" +
                        "                      <label class=\"weui_label\">证明人</label>\n" +
                        "                    </div>\n" +
                        "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                        "                      <input class=\"weui_input outfocus\" name=\"work\" type=\"text\" placeholder=\"请填写姓名\" value="+ data.data.work[i].prove_username +">\n" +
                        "                    </div>\n" +
                        "                  </div>\n" +
                        "                  <div class=\"weui_cell\">\n" +
                        "                    <div class=\"weui_cell_hd\">\n" +
                        "                      <label class=\"weui_label\">电话</label>\n" +
                        "                    </div>\n" +
                        "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                        "                      <input class=\"weui_input verify outfocus\" id="+ 'work' + i +" name=\"work\" type=\"number\" placeholder=\"请填写电话号码\" value="+ data.data.work[i].prove_mobile +">\n" +
                        "                    </div>\n" +
                        "                  </div>\n" +
                        "                </div>\n" +
                        "              </div>";
                    $('#experienceList').append(myli);
                }
            } else{
                let myli = "<div class=\"experBottom\">\n" +
                    "                <div class=\"experImgDetele workDelete\">\n" +
                    "                  <img src=\"./img/detele.svg\" alt=\"\">\n" +
                    "                </div>\n" +
                    "                <div class=\"heig\" style=\"height: 39px;background: #f3f3f3\"></div>\n" +
                    "                <div class=\"experListTop experienceList\">\n" +
                    "                  <div class=\"weui_cell\">\n" +
                    "                    <div class=\"weui_cell_hd\"><label for=\"\" class=\"weui_label\">开始时间</label></div>\n" +
                    "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                    "                      <input class=\"weui_input my-input\" naem=\"work\" id=\"my-input3\" type=\"text\" value=\"\">\n" +
                    "                    </div>\n" +
                    "                  </div>\n" +
                    "                  <div class=\"weui_cell\">\n" +
                    "                    <div class=\"weui_cell_hd\"><label for=\"\" class=\"weui_label\">结束时间</label></div>\n" +
                    "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                    "                      <input class=\"weui_input my-input\" name=\"work\" id=\"my-input4\" type=\"text\" value=\"\">\n" +
                    "                    </div>\n" +
                    "                  </div>\n" +
                    "                  <div class=\"weui_cell\">\n" +
                    "                    <div class=\"weui_cell_hd\">\n" +
                    "                      <label class=\"weui_label\">工作单位全称</label>\n" +
                    "                    </div>\n" +
                    "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                    "                      <input class=\"weui_input outfocus\" name=\"work\" type=\"text\" placeholder=\"请填写工作单位\">\n" +
                    "                    </div>\n" +
                    "                  </div>\n" +
                    "                  <div class=\"weui_cell\">\n" +
                    "                    <div class=\"weui_cell_hd\">\n" +
                    "                      <label class=\"weui_label\">部门及职位</label>\n" +
                    "                    </div>\n" +
                    "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                    "                      <input class=\"weui_input outfocus\" name=\"work\" type=\"text\" placeholder=\"请填写部门及职位\">\n" +
                    "                    </div>\n" +
                    "                  </div>\n" +
                    "                  <div class=\"weui_cell\">\n" +
                    "                    <div class=\"weui_cell_hd\">\n" +
                    "                      <label class=\"weui_label\">离职原因</label>\n" +
                    "                    </div>\n" +
                    "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                    "                      <input class=\"weui_input outfocus\" name=\"work\" type=\"text\" placeholder=\"请填写离职原因\">\n" +
                    "                    </div>\n" +
                    "                  </div>\n" +
                    "                  <div class=\"weui_cell\">\n" +
                    "                    <div class=\"weui_cell_hd\">\n" +
                    "                      <label class=\"weui_label\">证明人</label>\n" +
                    "                    </div>\n" +
                    "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                    "                      <input class=\"weui_input outfocus\" name=\"work\" type=\"text\" placeholder=\"请填写姓名\">\n" +
                    "                    </div>\n" +
                    "                  </div>\n" +
                    "                  <div class=\"weui_cell\">\n" +
                    "                    <div class=\"weui_cell_hd\">\n" +
                    "                      <label class=\"weui_label\">电话</label>\n" +
                    "                    </div>\n" +
                    "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                    "                      <input class=\"weui_input verify outfocus\" id=\"work\" name=\"work\" type=\"number\" placeholder=\"请填写电话号码\">\n" +
                    "                    </div>\n" +
                    "                  </div>\n" +
                    "                </div>\n" +
                    "              </div>";
                $('#experienceList').append(myli);
            }
            if(data.data.family.length>0) {
                for (let i = 0; i < data.data.family.length; i++) {
                    let myli = "<div class=\"familyBottom\">\n" +
                        "                <div class=\"experImgDetele familyDelete\">\n" +
                        "                  <img src=\"./img/detele.svg\" alt=\"\">\n" +
                        "                </div>\n" +
                        "                <div class=\"heig\" style=\"height: 39px;background: #f3f3f3\"></div>\n" +
                        "                <div class=\"experListTop familyList\">\n" +
                        "                  <div class=\"weui_cell\">\n" +
                        "                    <div class=\"weui_cell_hd\">\n" +
                        "                      <label class=\"weui_label\">姓名</label>\n" +
                        "                    </div>\n" +
                        "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                        "                      <input class=\"weui_input\" name=\"family\" type=\"text\" placeholder=\"请填写姓名 \" value="+ data.data.family[i].name +">\n" +
                        "                    </div>\n" +
                        "                  </div>\n" +
                        "                  <div class=\"weui_cell\">\n" +
                        "                    <div class=\"weui_cell_hd\">\n" +
                        "                      <label class=\"weui_label\">工作单位</label>\n" +
                        "                    </div>\n" +
                        "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                        "                      <input class=\"weui_input\" name=\"family\" type=\"text\" placeholder=\"请填写工作单位\" value="+ data.data.family[i].company_name +">\n" +
                        "                    </div>\n" +
                        "                  </div>\n" +
                        "                  <div class=\"weui_cell\">\n" +
                        "                    <div class=\"weui_cell_hd\">\n" +
                        "                      <label class=\"weui_label\">与本人关系</label>\n" +
                        "                    </div>\n" +
                        "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                        "                      <input class=\"weui_input\" name=\"family\" type=\"text\" placeholder=\"请填写与本人关系\" value="+ data.data.family[i].relation_name +">\n" +
                        "                    </div>\n" +
                        "                  </div>\n" +
                        "                  <div class=\"weui_cell\">\n" +
                        "                    <div class=\"weui_cell_hd\">\n" +
                        "                      <label class=\"weui_label\">联系电话</label>\n" +
                        "                    </div>\n" +
                        "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                        "                      <input class=\"weui_input verify\" id=\"family\" name=\"family\" type=\"number\" placeholder=\"请填写电话\" value="+ data.data.family[i].mobile +">\n" +
                        "                    </div>\n" +
                        "                  </div>\n" +
                        "                  <div class=\"weui_cell\">\n" +
                        "                    <div class=\"weui_cell_hd\">\n" +
                        "                      <label class=\"weui_label\">现所在地区</label>\n" +
                        "                    </div>\n" +
                        "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                        "                      <input class=\"weui_input\" name=\"family\" type=\"text\" placeholder=\"请填写所在地区\" value="+ data.data.family[i].city_name +">\n" +
                        "                    </div>\n" +
                        "                  </div>\n" +
                        "                </div>\n" +
                        "              </div>";
                    $('#familyList').append(myli);
                }
            } else{
                let myli = "<div class=\"familyBottom\">\n" +
                    "                <div class=\"experImgDetele familyDelete\">\n" +
                    "                  <img src=\"./img/detele.svg\" alt=\"\">\n" +
                    "                </div>\n" +
                    "                <div class=\"heig\" style=\"height: 39px;background: #f3f3f3\"></div>\n" +
                    "                <div class=\"experListTop familyList\">\n" +
                    "                  <div class=\"weui_cell\">\n" +
                    "                    <div class=\"weui_cell_hd\">\n" +
                    "                      <label class=\"weui_label\">姓名</label>\n" +
                    "                    </div>\n" +
                    "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                    "                      <input class=\"weui_input\" name=\"family\" type=\"text\" placeholder=\"请填写姓名 \">\n" +
                    "                    </div>\n" +
                    "                  </div>\n" +
                    "                  <div class=\"weui_cell\">\n" +
                    "                    <div class=\"weui_cell_hd\">\n" +
                    "                      <label class=\"weui_label\">工作单位</label>\n" +
                    "                    </div>\n" +
                    "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                    "                      <input class=\"weui_input\" name=\"family\" type=\"text\" placeholder=\"请填写工作单位\">\n" +
                    "                    </div>\n" +
                    "                  </div>\n" +
                    "                  <div class=\"weui_cell\">\n" +
                    "                    <div class=\"weui_cell_hd\">\n" +
                    "                      <label class=\"weui_label\">与本人关系</label>\n" +
                    "                    </div>\n" +
                    "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                    "                      <input class=\"weui_input\" name=\"family\" type=\"text\" placeholder=\"请填写与本人关系\">\n" +
                    "                    </div>\n" +
                    "                  </div>\n" +
                    "                  <div class=\"weui_cell\">\n" +
                    "                    <div class=\"weui_cell_hd\">\n" +
                    "                      <label class=\"weui_label\">联系电话</label>\n" +
                    "                    </div>\n" +
                    "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                    "                      <input class=\"weui_input verify\" id=\"family\" name=\"family\" type=\"number\" placeholder=\"请填写电话\">\n" +
                    "                    </div>\n" +
                    "                  </div>\n" +
                    "                  <div class=\"weui_cell\">\n" +
                    "                    <div class=\"weui_cell_hd\">\n" +
                    "                      <label class=\"weui_label\">现所在地区</label>\n" +
                    "                    </div>\n" +
                    "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                    "                      <input class=\"weui_input\" name=\"family\" type=\"text\" placeholder=\"请填写所在地区\">\n" +
                    "                    </div>\n" +
                    "                  </div>\n" +
                    "                </div>\n" +
                    "              </div>";
                $('#familyList').append(myli);
            }
        },
        error: function () {
            let rel = "<div class=\"urgencyBottom\">\n" +
                "                <div class=\"experImgDetele relDelete\">\n" +
                "                  <img src=\"./img/detele.svg\" alt=\"\">\n" +
                "                </div>\n" +
                "                <div class=\"heig\" style=\"height: 39px;background: #f3f3f3\"></div>\n" +
                "                <div class=\"experListTop urgencyList\">\n" +
                "                  <div class=\"weui_cell\">\n" +
                "                    <div class=\"weui_cell_hd\">\n" +
                "                      <label class=\"weui_label\">关系</label>\n" +
                "                    </div>\n" +
                "                    <div class=\"weui_cell_bd weui_cell_primary select\">\n" +
                "                      <input class=\"weui_input choice kinsfolk\" name=\"xialaganxi\" id=\"guanxi\" type=\"text\" placeholder=\"-- 请选择 --\">\n" +
                "                    </div>\n" +
                "                  </div>\n" +
                "                  <div class=\"weui_cell\">\n" +
                "                    <div class=\"weui_cell_hd\">\n" +
                "                      <label class=\"weui_label\">紧急联系人</label>\n" +
                "                    </div>\n" +
                "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                "                      <input class=\"weui_input\" type=\"text\" name=\"xiaName\" placeholder=\"请填写联系人姓名\">\n" +
                "                    </div>\n" +
                "                  </div>\n" +
                "                  <div class=\"weui_cell\">\n" +
                "                    <div class=\"weui_cell_hd\">\n" +
                "                      <label class=\"weui_label\">手机</label>\n" +
                "                    </div>\n" +
                "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                "                      <input class=\"weui_input\" type=\"number\" name=\"xiaPhone\" placeholder=\"请填写联系人手机\">\n" +
                "                    </div>\n" +
                "                  </div>\n" +
                "                </div>\n" +
                "              </div>";
            $('#urgencyList').append(rel);

            let edu = " <div class=\"educationBottom\">\n" +
                "                <div class=\"experImgDetele eduDelete\">\n" +
                "                  <img src=\"./img/detele.svg\" alt=\"\">\n" +
                "                </div>\n" +
                "                <div class=\"heig\" style=\"height: 39px;background: #f3f3f3\"></div>\n" +
                "                <div class=\"experListTop educationList\">\n" +
                "                  <div class=\"weui_cell\">\n" +
                "                    <div class=\"weui_cell_hd\"><label for=\"\" class=\"weui_label\">开始时间</label></div>\n" +
                "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                "                      <input class=\"weui_input my-input\" name=\"jytime\" id=\"kaishi\" type=\"text\" value=\"\">\n" +
                "                    </div>\n" +
                "                  </div>\n" +
                "                  <div class=\"weui_cell\">\n" +
                "                    <div class=\"weui_cell_hd\"><label for=\"\" class=\"weui_label\">结束时间</label></div>\n" +
                "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                "                      <input class=\"weui_input my-input\" name=\"jytimeend\" id=\"end\" type=\"text\" value=\"\">\n" +
                "                    </div>\n" +
                "                  </div>\n" +
                "                  <div class=\"weui_cell\">\n" +
                "                    <div class=\"weui_cell_hd\">\n" +
                "                      <label class=\"weui_label\">毕业院校全称</label>\n" +
                "                    </div>\n" +
                "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                "                      <input class=\"weui_input\" name=\"biyeyuanxiao\" type=\"text\" placeholder=\"请填写毕业院校\">\n" +
                "                    </div>\n" +
                "                  </div>\n" +
                "                  <div class=\"weui_cell\">\n" +
                "                    <div class=\"weui_cell_hd\">\n" +
                "                      <label class=\"weui_label\">专业</label>\n" +
                "                    </div>\n" +
                "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                "                      <input class=\"weui_input\" name=\"zhuanye\" type=\"text\" placeholder=\"请填写专业\">\n" +
                "                    </div>\n" +
                "                  </div>\n" +
                "                  <div class=\"weui_cell\">\n" +
                "                    <div class=\"weui_cell_hd\">\n" +
                "                      <label class=\"weui_label\">学历及学位</label>\n" +
                "                    </div>\n" +
                "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                "                      <input class=\"weui_input\" name=\"xuewei\" type=\"text\" placeholder=\"请填写学历及学位\">\n" +
                "                    </div>\n" +
                "                  </div>\n" +
                "                </div>\n" +
                "              </div>";
            $('#educationList').append(edu);

            let work = "<div class=\"experBottom\">\n" +
                "                <div class=\"experImgDetele workDelete\">\n" +
                "                  <img src=\"./img/detele.svg\" alt=\"\">\n" +
                "                </div>\n" +
                "                <div class=\"heig\" style=\"height: 39px;background: #f3f3f3\"></div>\n" +
                "                <div class=\"experListTop experienceList\">\n" +
                "                  <div class=\"weui_cell\">\n" +
                "                    <div class=\"weui_cell_hd\"><label for=\"\" class=\"weui_label\">开始时间</label></div>\n" +
                "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                "                      <input class=\"weui_input my-input\" naem=\"jltime\" id=\"my-input3\" type=\"text\" value=\"\">\n" +
                "                    </div>\n" +
                "                  </div>\n" +
                "                  <div class=\"weui_cell\">\n" +
                "                    <div class=\"weui_cell_hd\"><label for=\"\" class=\"weui_label\">结束时间</label></div>\n" +
                "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                "                      <input class=\"weui_input my-input\" name=\"jltimeend\" id=\"my-input4\" type=\"text\" value=\"\">\n" +
                "                    </div>\n" +
                "                  </div>\n" +
                "                  <div class=\"weui_cell\">\n" +
                "                    <div class=\"weui_cell_hd\">\n" +
                "                      <label class=\"weui_label\">工作单位全称</label>\n" +
                "                    </div>\n" +
                "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                "                      <input class=\"weui_input outfocus\" name=\"jldanwei\" type=\"text\" placeholder=\"请填写工作单位\">\n" +
                "                    </div>\n" +
                "                  </div>\n" +
                "                  <div class=\"weui_cell\">\n" +
                "                    <div class=\"weui_cell_hd\">\n" +
                "                      <label class=\"weui_label\">部门及职位</label>\n" +
                "                    </div>\n" +
                "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                "                      <input class=\"weui_input outfocus\" name=\"jlzhiwei\" type=\"text\" placeholder=\"请填写部门及职位\">\n" +
                "                    </div>\n" +
                "                  </div>\n" +
                "                  <div class=\"weui_cell\">\n" +
                "                    <div class=\"weui_cell_hd\">\n" +
                "                      <label class=\"weui_label\">离职原因</label>\n" +
                "                    </div>\n" +
                "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                "                      <input class=\"weui_input outfocus\" name=\"jllizhi\" type=\"text\" placeholder=\"请填写离职原因\">\n" +
                "                    </div>\n" +
                "                  </div>\n" +
                "                  <div class=\"weui_cell\">\n" +
                "                    <div class=\"weui_cell_hd\">\n" +
                "                      <label class=\"weui_label\">证明人</label>\n" +
                "                    </div>\n" +
                "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                "                      <input class=\"weui_input outfocus\" name=\"jlren\" type=\"text\" placeholder=\"请填写姓名\">\n" +
                "                    </div>\n" +
                "                  </div>\n" +
                "                  <div class=\"weui_cell\">\n" +
                "                    <div class=\"weui_cell_hd\">\n" +
                "                      <label class=\"weui_label\">电话</label>\n" +
                "                    </div>\n" +
                "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                "                      <input class=\"weui_input outfocus\" name=\"jlphone\" type=\"number\" placeholder=\"请填写电话号码\">\n" +
                "                    </div>\n" +
                "                  </div>\n" +
                "                </div>\n" +
                "              </div>";
            $('#experienceList').append(work);

            let family = "<div class=\"familyBottom\">\n" +
                "                <div class=\"experImgDetele familyDelete\">\n" +
                "                  <img src=\"./img/detele.svg\" alt=\"\">\n" +
                "                </div>\n" +
                "                <div class=\"heig\" style=\"height: 39px;background: #f3f3f3\"></div>\n" +
                "                <div class=\"experListTop familyList\">\n" +
                "                  <div class=\"weui_cell\">\n" +
                "                    <div class=\"weui_cell_hd\">\n" +
                "                      <label class=\"weui_label\">姓名</label>\n" +
                "                    </div>\n" +
                "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                "                      <input class=\"weui_input\" name=\"jtname\" type=\"text\" placeholder=\"请填写姓名 \">\n" +
                "                    </div>\n" +
                "                  </div>\n" +
                "                  <div class=\"weui_cell\">\n" +
                "                    <div class=\"weui_cell_hd\">\n" +
                "                      <label class=\"weui_label\">工作单位</label>\n" +
                "                    </div>\n" +
                "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                "                      <input class=\"weui_input\" name=\"jtdanwei\" type=\"text\" placeholder=\"请填写工作单位\">\n" +
                "                    </div>\n" +
                "                  </div>\n" +
                "                  <div class=\"weui_cell\">\n" +
                "                    <div class=\"weui_cell_hd\">\n" +
                "                      <label class=\"weui_label\">与本人关系</label>\n" +
                "                    </div>\n" +
                "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                "                      <input class=\"weui_input\" name=\"jtguanxi\" type=\"text\" placeholder=\"请填写与本人关系\">\n" +
                "                    </div>\n" +
                "                  </div>\n" +
                "                  <div class=\"weui_cell\">\n" +
                "                    <div class=\"weui_cell_hd\">\n" +
                "                      <label class=\"weui_label\">联系电话</label>\n" +
                "                    </div>\n" +
                "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                "                      <input class=\"weui_input\" name=\"jtphone\" type=\"number\" placeholder=\"请填写电话\">\n" +
                "                    </div>\n" +
                "                  </div>\n" +
                "                  <div class=\"weui_cell\">\n" +
                "                    <div class=\"weui_cell_hd\">\n" +
                "                      <label class=\"weui_label\">现所在地区</label>\n" +
                "                    </div>\n" +
                "                    <div class=\"weui_cell_bd weui_cell_primary\">\n" +
                "                      <input class=\"weui_input\" name=\"jtdiqu\" type=\"text\" placeholder=\"请填写所在地区\">\n" +
                "                    </div>\n" +
                "                  </div>\n" +
                "                </div>\n" +
                "              </div>";
            $('#familyList').append(family);
        }
    });
    // 动态添加紧急联系人
    r = 1;
    $(document).on('click','.relation', function(){
        let ret = ($(".urgencyList").length);
        if (ret == 3) {
            $.toast("紧急联系人最多只能添加三个");
            return false
        }
        $(".relationBox").append('<div class="deteleBox urgencyList">\n' +
            '              <div class="experImgDetele relDelete">\n' +
            '               <img src="./img/detele.svg" alt="">\n' +
            '                </div>\n' +
            '              <div style="height: 39px;background: #f3f3f3"></div>\n' +
            '              <div class="weui_cell">\n' +
            '                <div class="weui_cell_hd">\n' +
            '                  <label class="weui_label">关系</label>\n' +
            '                </div>\n' +
            '                <div class="weui_cell_bd weui_cell_primary select">\n' +
            '                  <input class="weui_input choice kinsfolk" name="urgency" id="guanxi'+ r + 1 +'" type="text" placeholder="-- 请选择 --">\n' +
            '                </div>\n' +
            '              </div>\n' +
            '              <div class="weui_cell">\n' +
            '                <div class="weui_cell_hd">\n' +
            '                  <label class="weui_label">紧急联系人</label>\n' +
            '                </div>\n' +
            '                <div class="weui_cell_bd weui_cell_primary">\n' +
            '                  <input class="weui_input" type="text" name="urgency" placeholder="请输入联系人姓名">\n' +
            '                </div>\n' +
            '              </div>\n' +
            '              <div class="weui_cell">\n' +
            '                <div class="weui_cell_hd">\n' +
            '                  <label class="weui_label">手机</label>\n' +
            '                </div>\n' +
            '                <div class="weui_cell_bd weui_cell_primary">\n' +
            '                  <input class="weui_input" type="number" name="urgency" placeholder="请输入联系人手机">\n' +
            '                </div>\n' +
            '              </div>\n' +
            '            </div>');
        r = r + 1;
    } );
    // 删除紧急联系人
    $(document).on('click','.relDelete', function(){
        $(this).parent().remove();
    } );
    // 动态添加教育经历
    e = 1;
    $(document).on('click','.education', function(){
        let ret = ($(".educationList").length);
        if (ret == 3) {
            $.toast("教育经历最多只能添加三个");
            return false
        }
        $(".educationBox").append('<div class="deteleBox educationList">\n' +
            '              <div class="experImgDetele eduDelete">\n' +
            '                <img src="./img/detele.svg" alt="">\n' +
            '              </div>\n' +
            '              <div style="height: 39px;background: #f3f3f3"></div>\n' +
            '              <div class="weui_cell">\n' +
            '                <div class="weui_cell_hd"><label for="" class="weui_label">开始时间</label></div>\n' +
            '                <div class="weui_cell_bd weui_cell_primary">\n' +
            '                  <input class="weui_input my-input" name="edu" id="kaishi'+ e + 1 +'" type="text" value="">\n' +
            '                </div>\n' +
            '              </div>\n' +
            '              <div class="weui_cell">\n' +
            '                <div class="weui_cell_hd"><label for="" class="weui_label">结束时间</label></div>\n' +
            '                <div class="weui_cell_bd weui_cell_primary">\n' +
            '                  <input class="weui_input my-input" name="edu" id="end'+ e + 1 +'" type="text" value="">\n' +
            '                </div>\n' +
            '              </div>\n' +
            '              <div class="weui_cell">\n' +
            '                <div class="weui_cell_hd">\n' +
            '                  <label class="weui_label">毕业院校全称</label>\n' +
            '                </div>\n' +
            '                <div class="weui_cell_bd weui_cell_primary">\n' +
            '                  <input class="weui_input" name="edu" type="text" placeholder="请输入毕业院校">\n' +
            '                </div>\n' +
            '              </div>\n' +
            '              <div class="weui_cell">\n' +
            '                <div class="weui_cell_hd">\n' +
            '                  <label class="weui_label">专业</label>\n' +
            '                </div>\n' +
            '                <div class="weui_cell_bd weui_cell_primary">\n' +
            '                  <input class="weui_input" name="edu" type="text" placeholder="请输入专业">\n' +
            '                </div>\n' +
            '              </div>\n' +
            '              <div class="weui_cell">\n' +
            '                <div class="weui_cell_hd">\n' +
            '                  <label class="weui_label">学历及学位</label>\n' +
            '                </div>\n' +
            '                <div class="weui_cell_bd weui_cell_primary">\n' +
            '                  <input class="weui_input educat" id="education'+ e + 1 +'" name="edu" type="text" placeholder="-- 请选择 --">\n' +
            '                </div>\n' +
            '              </div>\n' +
            '            </div>');
        e = e + 1;
    } );
    // 删除教育经历
    $(document).on('click','.eduDelete', function(){
        $(this).parent().remove();
    } );
    // 动态添加工作经历
    n = 3;
    $(document).on('click','.work', function(){
        let ret = ($(".experienceList").length);
        if (ret == 3) {
            $.toast("工作经历最多只能添加三个");
            return false
        }
        $(".workBox").append('<div class="deteleBox experienceList">\n' +
            '              <div class="experImgDetele workDelete">\n' +
            '                <img src="./img/detele.svg" alt="">\n' +
            '              </div>\n' +
            '              <div style="height: 39px;background: #f3f3f3"></div>\n' +
            '              <div class="weui_cell">\n' +
            '                <div class="weui_cell_hd"><label for="" class="weui_label">开始时间</label></div>\n' +
            '                <div class="weui_cell_bd weui_cell_primary">\n' +
            '                  <input class="weui_input my-input" name="work" id="my-input'+ n + 1 +'" type="text" value="">\n' +
            '                </div>\n' +
            '              </div>\n' +
            '              <div class="weui_cell">\n' +
            '                <div class="weui_cell_hd"><label for="" class="weui_label">结束时间</label></div>\n' +
            '                <div class="weui_cell_bd weui_cell_primary">\n' +
            '                  <input class="weui_input my-input" name="work" id="my-input'+ n + 2 +'" type="text" value="">\n' +
            '                </div>\n' +
            '              </div>\n' +
            '              <div class="weui_cell">\n' +
            '                <div class="weui_cell_hd">\n' +
            '                  <label class="weui_label">工作单位全称</label>\n' +
            '                </div>\n' +
            '                <div class="weui_cell_bd weui_cell_primary">\n' +
            '                  <input class="weui_input outfocus" name="work" type="text" placeholder="请输入工作单位">\n' +
            '                </div>\n' +
            '              </div>\n' +
            '              <div class="weui_cell">\n' +
            '                <div class="weui_cell_hd">\n' +
            '                  <label class="weui_label">部门及职位</label>\n' +
            '                </div>\n' +
            '                <div class="weui_cell_bd weui_cell_primary">\n' +
            '                  <input class="weui_input outfocus" name="work" type="text" placeholder="请输入部门及职位">\n' +
            '                </div>\n' +
            '              </div>\n' +
            '              <div class="weui_cell">\n' +
            '                <div class="weui_cell_hd">\n' +
            '                  <label class="weui_label">离职原因</label>\n' +
            '                </div>\n' +
            '                <div class="weui_cell_bd weui_cell_primary">\n' +
            '                  <input class="weui_input outfocus" name="work" type="text" placeholder="请填写离职原因">\n' +
            '                </div>\n' +
            '              </div>\n' +
            '              <div class="weui_cell">\n' +
            '                <div class="weui_cell_hd">\n' +
            '                  <label class="weui_label">证明人</label>\n' +
            '                </div>\n' +
            '                <div class="weui_cell_bd weui_cell_primary">\n' +
            '                  <input class="weui_input outfocus" name="work" type="text" placeholder="请输入姓名">\n' +
            '                </div>\n' +
            '              </div>\n' +
            '              <div class="weui_cell">\n' +
            '                <div class="weui_cell_hd">\n' +
            '                  <label class="weui_label">电话</label>\n' +
            '                </div>\n' +
            '                <div class="weui_cell_bd weui_cell_primary">\n' +
            '                  <input class="weui_input verify outfocus" id="work'+ n + '" name="work" type="number" placeholder="请输入电话号码">\n' +
            '                </div>\n' +
            '              </div>\n' +
            '            </div>');
        n = n + 1;
    } );
    // 删除工作经历
    $(document).on('click','.workDelete', function(){
        $(this).parent().remove();
    } );
    // 动态添加家庭成员
    d = 3
    $(document).on('click','.family', function(){
        let ret = ($(".familyList").length);
        if (ret == 3) {
            $.toast("教育经历最多只能添加三个");
            return false
        }
        $(".familyBox").append('<div class="deteleBox familyList">\n' +
            '              <div class="experImgDetele familyDelete">\n' +
            '                <img src="./img/detele.svg" alt="">\n' +
            '              </div>\n' +
            '              <div style="height: 39px;background: #f3f3f3"></div>\n' +
            '              <div class="weui_cell">\n' +
            '                <div class="weui_cell_hd">\n' +
            '                  <label class="weui_label">姓名</label>\n' +
            '                </div>\n' +
            '                <div class="weui_cell_bd weui_cell_primary">\n' +
            '                  <input class="weui_input" name="family" type="text" placeholder="请输入姓名 ">\n' +
            '                </div>\n' +
            '              </div>\n' +
            '              <div class="weui_cell">\n' +
            '                <div class="weui_cell_hd">\n' +
            '                  <label class="weui_label">工作单位</label>\n' +
            '                </div>\n' +
            '                <div class="weui_cell_bd weui_cell_primary">\n' +
            '                  <input class="weui_input" name="family" type="text" placeholder="请输入工作单位">\n' +
            '                </div>\n' +
            '              </div>\n' +
            '              <div class="weui_cell">\n' +
            '                <div class="weui_cell_hd">\n' +
            '                  <label class="weui_label">与本人关系</label>\n' +
            '                </div>\n' +
            '                <div class="weui_cell_bd weui_cell_primary">\n' +
            '                  <input class="weui_input" name="family" type="text" placeholder="请输入与本人关系">\n' +
            '                </div>\n' +
            '              </div>\n' +
            '              <div class="weui_cell">\n' +
            '                <div class="weui_cell_hd">\n' +
            '                  <label class="weui_label">联系电话</label>\n' +
            '                </div>\n' +
            '                <div class="weui_cell_bd weui_cell_primary">\n' +
            '                  <input class="weui_input verify" id="family'+ d + '" name="family" type="number" placeholder="请输入电话">\n' +
            '                </div>\n' +
            '              </div>\n' +
            '              <div class="weui_cell">\n' +
            '                <div class="weui_cell_hd">\n' +
            '                  <label class="weui_label">现所在地区</label>\n' +
            '                </div>\n' +
            '                <div class="weui_cell_bd weui_cell_primary">\n' +
            '                  <input class="weui_input verify" id="family" name="family" type="text" placeholder="请输入所在地区">\n' +
            '                </div>\n' +
            '              </div>\n' +
            '            </div>');
        d = d + 1;
    } );
    // 删除家庭成员
    $(document).on('click','.familyDelete', function(){
        $(this).parent().remove();
    } );
    // 验证正则表达式
    $(document).on('blur','.verify', function() {
        var id = $(this).attr("id");
        var pattern = $("#" + id).val();
        // 手机
        if (id === 'phone'|| id === 'work' || id === 'work0' || id === 'work1' || id === 'work2' || id === 'work3' || id === 'work4' || id === 'work5' || id === 'family' || id === 'family0' || id === 'family1' || id === 'family2' || id === 'family3' || id === 'family4' || id === 'family5') {
            if(pattern === '' || pattern && /^1[3|4|5|8]\d{9}$/.test(pattern)){
            } else{
                $.toptip('手机号码输入错误', 'error');
                return false
            }
        }
        // 身份证
        if (id === 'pattern') {
            if(pattern === '' || pattern && /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(pattern)){
            } else{
                $.toptip('身份证号码输入错误', 'error');
                return false
            }
        }
        // 邮箱
        if (id === 'email') {
            if(pattern === '' || pattern && /^\w+@\w+(.[a-zA-Z]{2,3}){1,2}$/.test(pattern)){
            } else{
                $.toptip('邮箱输入错误', 'error');
                return false
            }
        }
    });
    // 下拉选择紧急联系人
    $(document).on('touchstart','.kinsfolk', function(){
        var id = $(this).attr("id");
        $("#" + id).picker({
            title: "-- 请选择 --",
            cols: [
                {
                    textAlign: 'center',
                    values:  ["直系亲属", "同学朋友"]
                }
            ]
        });
    })
    // 婚姻
    $("#marriage").picker({
        title: "-- 请选择 --",
        cols: [
            {
                textAlign: 'center',
                values:  ["未婚", "已婚已育", "已婚未育", "其他"]
            }
        ]
    });
    // 学历
    $(document).on('touchstart','.educat', function() {
        let id = $(this).attr("id");
        $("#" + id).picker({
            title: "-- 请选择 --",
            cols: [
                {
                    textAlign: 'center',
                    values: ["初中及以下", "高中", "中专", "技校/职高", "大专", "本科", "硕士", "博士及以上", "其他"]
                }
            ]
        })
    })
    // 民族
    $("#nation").picker({
        title: "-- 请选择 --",
        cols: [
            {
                textAlign: 'center',
                values:  [
                    "汉族", "蒙古族", "回族", "藏族", "维吾尔族", "苗族", "彝族","壮族", "布依族", "朝鲜族", "满族", "侗族",
                    "瑶族", "白族", "土家族", "哈尼族", "哈萨克族", "傣族", "黎族", "僳僳族","佤族", "畲族", "高山族", "拉祜族",
                    "水族", "东乡族", "纳西族", "景颇族", "柯尔克孜族", "土族", "达斡尔族", "仫佬族", "羌族","布朗族", "撒拉族",
                    "毛南族", "仡佬族", "锡伯族", "阿昌族", "普米族", "塔吉克族", "怒族", "乌孜别克族", "俄罗斯族", "鄂温克族",
                    "德昂族","保安族", "裕固族", "京族", "塔塔尔族", "独龙族", "鄂伦春族", "赫哲族", "门巴族", "珞巴族", "基诺族",
                ]
            }
        ]
    });
    // 籍贯
    $("#native").cityPicker({
        title: "-- 请选择 --"
    });
    // 日历
    $(document).on('touchstart','.my-input', function(){
        let id = $(this).attr("id");
        $("#" + id).datetimePicker({
            title: '-- 请选择日期 --',
            min: "1990-12-12",
            max: "2070-12-12 12:12",
            times: function () {
                return [];
            },
            onChange: function (picker, values, displayValues) {}
        });
        $(".outfocus").blur();
    });
    // 离焦事件
    $(document).on('touchstart','.choice', function(){
        $(".outfocus").blur();
    });
    // 提交
    $(document).on('click', '#btnSub', function () {
        let channel_one = $('.trench1').val()
        for (var index in typeTval) {
            if (channel_one == typeTval[index].name) {
                var trench1 = typeTval[index].value
            }
        }
        let channel_two = $('.trench2').val()
        if (channel_two == name_channel) {
            var chan_id = channel_id
        }else {
            for (var index in arrList) {
                if (channel_two == arrList[index].name) {
                    var chan_id = arrList[index].value
                }
            }
        }
        let name = $('.myName').val()
        if ($("input[type='radio'][name='radio1']:checked").val() == 0) {
            var sex = '女'
        }else{
            var sex = '男'
        }
        let phone = $('.phone').val()
        let invName = $('.inviteName').val()
        let birthday = $('.birthday').val()
        let email = $('.email').val()
        let WeChat = $('.WeChat').val()
        for (var index in position1) {
            if ($('.position').val() == position1[index].name) {
                var position = position1[index].value
            }

        }
        let native = $('.native').val()
        let nation = $('.nation').val()
        let marriage = $('.marriage').val()
        let politics = $('.politics').val()
        let identity = $('.identity').val()
        let registe = $('.registe').val()
        let weight = $('.weight').val()
        let stature = $('.stature').val()
        let site = $('.site').val()
        let certificate = $('.certificate').val()
        let hobby = $('.hobby').val()
        let speciality = $('.speciality').val()

        let gsName = $('.gsName').val()
        let gsGuan = $('.gsGuan').val()
        let sxName = $('.sxName').val()
        let sxGuan = $('.sxGuan').val()
        let buyName = $('.buyName').val()
        let noShihe = $('.noShihe').val()


        if(channel_one == ''|| channel_one == null || channel_one == undefined) {
            $.alert('渠道类型不能为空!', '温馨提示');
            return false;
        }
        if(channel_two == ''|| channel_two == null || channel_two == undefined) {
            $.alert('应聘渠道不能为空!', '温馨提示');
            return false;
        }
        if(name == ''|| name == null || name == undefined) {
            $.alert('姓名不能为空!', '温馨提示');
            return false;
        }
        if(phone == ''|| phone == null || phone == undefined) {
            $.alert('手机不能为空!', '温馨提示');
            return false;
        }
        // 获取紧急联系人
        var content = [];
        var img_url = [];
        var tempfrom = {}
        var tempfrom1 = {}
        var tempfrom2 = {}
        $("input[name='urgency']").each(function () {
            img_url.push($(this).val());
        })
        var brr1 = [];
        var brr2 = [];
        var brr3 = [];
        if (img_url.length == 3) {
            for (let i = 0; i < img_url.length; i++) {
                brr1[i] = img_url[i];
            }
        }
        if (img_url.length == 6) {
            for (let i = 0; i < img_url.length / 2; i++) {
                brr1[i] = img_url[i];
                brr2[i] = img_url[i + img_url.length / 2];
            }
        }
        if (img_url.length == 9) {
            for (let i = 0; i < img_url.length / 3; i++) {
                brr1[i] = img_url[i];
                brr2[i] = img_url[i + img_url.length / 3];
                brr3[i] = img_url[i + img_url.length / 9 * 6];
            }
        }
        tempfrom["relation_name"] = brr1[0]
        tempfrom["name"] = brr1[1]
        tempfrom["mobile"] = brr1[2]
        tempfrom1["relation_name"] = brr2[0]
        tempfrom1["name"] = brr2[1]
        tempfrom1["mobile"] = brr2[2]
        tempfrom2["relation_name"] = brr3[0]
        tempfrom2["name"] = brr3[1]
        tempfrom2["mobile"] = brr3[2]
        content.push(tempfrom)
        content.push(tempfrom1)
        content.push(tempfrom2)
        // 获取教育经历
        var education = [];
        var edu_url = [];
        var edufrom = {}
        var edufrom1 = {}
        var edufrom2 = {}
        $("input[name='edu']").each(function () {
            edu_url.push($(this).val());
        })
        var edu1 = [];
        var edu2 = [];
        var edu3 = [];
        if (edu_url.length == 5) {
            for (let i = 0; i < edu_url.length; i++) {
                edu1[i] = edu_url[i];
            }
        }
        if (edu_url.length == 10) {
            for (let i = 0; i < edu_url.length / 2; i++) {
                edu1[i] = edu_url[i];
                edu2[i] = edu_url[i + edu_url.length / 2];
            }
        }
        if (edu_url.length == 15) {
            for (let i = 0; i < edu_url.length / 3; i++) {
                edu1[i] = edu_url[i];
                edu2[i] = edu_url[i + edu_url.length / 3];
                edu3[i] = edu_url[i + edu_url.length / 15 * 10];
            }
        }
        edufrom["start_date"] = edu1[0]
        edufrom["end_date"] = edu1[1]
        edufrom["school_name"] = edu1[2]
        edufrom["major"] = edu1[3]
        edufrom["degree_name"] = edu1[4]
        edufrom1["start_date"] = edu2[0]
        edufrom1["end_date"] = edu2[1]
        edufrom1["school_name"] = edu2[2]
        edufrom1["major"] = edu2[3]
        edufrom1["degree_name"] = edu2[4]
        edufrom2["start_date"] = edu3[0]
        edufrom2["end_date"] = edu3[1]
        edufrom2["school_name"] = edu3[2]
        edufrom2["major"] = edu3[3]
        edufrom2["degree_name"] = edu3[4]
        education.push(edufrom)
        education.push(edufrom1)
        education.push(edufrom2)
        // 获取工作经历
        var work = [];
        var work_url = [];
        var workfrom = {}
        var workfrom1 = {}
        var workfrom2 = {}
        $("input[name='work']").each(function () {
            work_url.push($(this).val());
        })
        var work1 = [];
        var work2 = [];
        var work3 = [];
        if (work_url.length == 7) {
            for (let i = 0; i < work_url.length; i++) {
                work1[i] = work_url[i];
            }
        }
        if (work_url.length == 14) {
            for (let i = 0; i < work_url.length / 2; i++) {
                work1[i] = work_url[i];
                work2[i] = work_url[i + edu_url.length / 2];
            }
        }
        if (work_url.length == 21) {
            for (let i = 0; i < work_url.length / 3; i++) {
                work1[i] = work_url[i];
                work2[i] = work_url[i + work_url.length / 3];
                work3[i] = work_url[i + work_url.length / 21 * 14];
            }
        }
        workfrom["start_date"] = work1[0]
        workfrom["end_date"] = work1[1]
        workfrom["company_name"] = work1[2]
        workfrom["job_name"] = work1[3]
        workfrom["leave_reason"] = work1[4]
        workfrom["prove_username"] = work1[5]
        workfrom["prove_mobile"] = work1[6]
        workfrom1["start_date"] = work1[0]
        workfrom1["end_date"] = work1[1]
        workfrom1["company_name"] = work1[2]
        workfrom1["job_name"] = work1[3]
        workfrom1["leave_reason"] = work1[4]
        workfrom1["prove_username"] = work1[5]
        workfrom1["prove_mobile"] = work1[6]
        workfrom2["start_date"] = work1[0]
        workfrom2["end_date"] = work1[1]
        workfrom2["company_name"] = work1[2]
        workfrom2["job_name"] = work1[3]
        workfrom2["leave_reason"] = work1[4]
        workfrom2["prove_username"] = work1[5]
        workfrom2["prove_mobile"] = work1[6]
        work.push(workfrom)
        work.push(workfrom1)
        work.push(workfrom2)
        // 获取家庭成员
        var family = [];
        var family_url = [];
        var familyfrom = {}
        var familyfrom1 = {}
        var familyfrom2 = {}
        $("input[name='family']").each(function () {
            family_url.push($(this).val());
        })
        var family1 = [];
        var family2 = [];
        var family3 = [];
        if (family_url.length == 5) {
            for (let i = 0; i < family_url.length; i++) {
                family1[i] = family_url[i];
            }
        }
        if (family_url.length == 10) {
            for (let i = 0; i < family_url.length / 2; i++) {
                family1[i] = family_url[i];
                family2[i] = family_url[i + edu_url.length / 2];
            }
        }
        if (family_url.length == 15) {
            for (let i = 0; i < family_url.length / 3; i++) {
                family1[i] = family_url[i];
                family2[i] = family_url[i + family_url.length / 3];
                family3[i] = family_url[i + family_url.length / 15 * 10];
            }
        }
        familyfrom["name"] = family1[0]
        familyfrom["company_name"] = family1[1]
        familyfrom["relation_name"] = family1[2]
        familyfrom["mobile"] = family1[3]
        familyfrom["city_name"] = family1[4]
        familyfrom1["name"] = family2[0]
        familyfrom1["company_name"] = family2[1]
        familyfrom1["relation_name"] = family2[2]
        familyfrom1["mobile"] = family2[3]
        familyfrom1["city_name"] = family2[4]
        familyfrom2["name"] = family3[0]
        familyfrom2["company_name"] = family3[1]
        familyfrom2["relation_name"] = family3[2]
        familyfrom2["mobile"] = family3[3]
        familyfrom2["city_name"] = family3[4]
        family.push(familyfrom)
        family.push(familyfrom1)
        family.push(familyfrom2)

        $.modal({
            title: "温馨提示",
            text: "请再次检查信息，确认资料属实、无误！",
            buttons: [
                {
                    text: "确定",
                    onClick: function(){
                        let key = '195a9b99ea7a0d259151b5c412bb631b';
                        $.ajax({
                            type: "post",
                            url: "http://hplqytest.suoluomei.cn/index.php?s=/Hr/Index/hh",
                            data: {
                                api_key: key,
                                channel_type: trench1,
                                channel_id: chan_id,
                                name: name,
                                sex: sex,
                                mobile: phone,
                                invitations: invName,
                                birth: birthday,
                                email: email,
                                wechat: WeChat,
                                name_job: position,
                                native_place: native,
                                nation: nation,
                                marriage: marriage,
                                politics: politics,
                                idcard: identity,
                                household: registe,
                                weight: weight,
                                height: stature,
                                address: site,
                                certificate: certificate,
                                hobby: hobby,
                                speciality: speciality,
                                content: content,
                                study: education,
                                work: work,
                                family: family,
                                is_buy_product: buy,
                                is_company_relatives: gs,
                                is_compete_relatives: sx,
                                is_not_arrange_work: shihe,
                                company_relatives_name: gsName,
                                company_relatives_relation: gsGuan,
                                compete_relatives_name: sxName,
                                compete_relatives_relation: sxGuan,
                                hf_teacher_name: buyName,
                                not_arrange_work: noShihe,
                            },
                            success: function (result) {
                                $.toast("提交成功");
                                $("input[type='text']").val('')
                                $("input[type='number']").val('')
                                $("input[type='email']").val('')
                            },
                            error: function () {
                                $.toast("提交失败");
                            }
                        })
                    }
                },
                {
                    text: "取消",
                    className: "default",
                    onClick: function() {}
                },
            ]
        });
    })
}

function ajax(url, val, cb) {
    let key = '195a9b99ea7a0d259151b5c412bb631b';
    let val1 = val
    $.ajax({
        type: "POST",
        url: url,
        data: {api_key: key, typeTrench: val1},
        dataType: "json",
        success: function (response) {
            if (typeof cb == "function") {
                cb(response)
            }
        }
    });
}
